<template>
	<view>
		<view class="bg">
			<view style="margin-left: 102rpx;">
				<LotteryDraw @get_winingIndex='get_winingIndex'  @luck_draw_finish='luck_draw_finish' :grid_info_arr='prizeList'></LotteryDraw>
			</view>
			
			<view class="img-106">
				<scroll-view :scroll-y="true" class="detail">{{obj.activityDescription}}</scroll-view>
			</view>
			
			<image @click="tips()" class="img-35" src="../../static/105.png"></image>
			
			<view style="height: 20rpx;"></view>
			
		</view>
		
		<view class="pos-left" @click="tips()">
			<image class="head" src=""></image>
			<view class="pos-name font-overflow">商家名称</view>
			<view class="pos-but">关注</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//九宫格
				lottery_draw_param:{
					startIndex: 0, //开始抽奖位置，从0开始
					totalCount: 5, //一共要转的圈数
					winingIndex: 4, //中奖的位置，从0开始
					speed: 70 //抽奖动画的速度 [数字越大越慢,默认100]
				},
				
				prizeList: [],
				obj: {},
			}
		},
		
		onLoad(options) {
			if (options.id){
				this.id = options.id;
				this.detail();
			}
		},
		
		onShow() {
			
		},
		
		methods: {
			
			//活动详情
			async detail() {
				const result = await this.$http.get({
					url: this.$api.selectGetId,
					data: {
						id: this.id,
					}
				});
				if (result.code == 2000) {
					this.prizeList = result.data.listofprizes;
					this.obj = result.data;
					this.prizeList.push([])
				} else {
					this.$sun.toast(result.msg, 'none');
				}
			},
			
			tips() {
				this.$sun.toast("此页面为活动预览页!",'none');
			},
			
			/*  九宫格  */
			
			// 修改获奖位置（可以在这里获取后台的数据
			get_winingIndex(callback){
				this.tips();
				//props修改在小程序和APP端不成功，所以在这里使用回调函数传参，
				// callback(this.lottery_draw_param);
			},
			// 抽奖完成
			luck_draw_finish(param){
				console.log("222222222222222");
			},
			
		}
	}
</script>

<style lang="scss">
	
	.detail {
		width: 580rpx;
		height: 340rpx;
		color: #FFFFFF;
		padding: 120rpx 40rpx 40rpx;
	}
	
	.img-106 {
		background: url('~static/106.png');
		width: 674rpx;
		height: 526rpx;
		background-repeat: no-repeat;
		background-size: contain;
		margin: 120rpx 38rpx 40rpx 38rpx;
	}
	
	.pos-but {
		width: 80rpx;
		border-radius: 36rpx;
		background-color: #FFBC00;
		color: #FFFFFF;
		font-size: 24rpx;
		text-align: center;
		padding: 10rpx;
	}
	
	.pos-name {
		width: 160rpx;
		color: #FFFFFF;
	}
	
	.head {
		width: 64rpx;
		height: 64rpx;
		border-radius: 50%;
		background-color: #aaaaaa;
		margin-right: 14rpx;
	}
	
	.pos-left {
		width: 320rpx;
		background: rgba(0, 0, 0, 0.40);
		border-radius: 60rpx;
		z-index: 9;
		position: fixed;
		top: 30rpx;
		left: 20rpx;
		display: flex;
		align-items: center;
	}
	
	.img-35 {
		width: 510rpx;
		height: 108rpx;
		margin-left: 120rpx;
	}
	
	.bg {
		background: url('~static/33.png');
		width: 750rpx;
		height: 1502rpx;
		background-repeat: no-repeat;
		background-size: contain;
		padding: 468rpx 0 20rpx;
	}
	
	page {
		background-color: #0061FF;
	}
	
</style>
